﻿Imports System.Threading

Public Class Form_SetIDMannully

    Public ParentForm As Form_ReadEEPROMMainPage
    Public Sub New(parent As Form_ReadEEPROMMainPage)

        ' This call is required by the designer.
        InitializeComponent()
        ParentForm = parent

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub ButtonSet_Click(sender As Object, e As EventArgs) Handles ButtonSet.Click

        Try
            If Me.TextBoxID.Text.Length <> 2 Then
                Return
            End If
            Dim a = CInt(Me.TextBoxID.Text)


        Catch ex As Exception

            MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error")
            Return

        End Try

        ParentForm.m_CANMatrix.ID = Me.TextBoxID.Text
        ParentForm.m_FeedBackResults.MyCanMatrix = ParentForm.m_CANMatrix
        ParentForm.TextBoxInfoACT.Text += vbCrLf & "Set ID to: " & Me.TextBoxID.Text
        CheckForIllegalCrossThreadCalls = False

        ParentForm.m_SendTread = New Thread(AddressOf ParentForm.SpecificCommandReadSequence)
        ParentForm.m_SendTread.Start()
        Me.Close()




    End Sub

    Private Sub ButtonCancel_Click(sender As Object, e As EventArgs) Handles ButtonCancel.Click
        Me.Close()
    End Sub
End Class